package im_server

import (
	"encoding/json"
	"pim/pkg/codes"
	"pim/pkg/models"
)

// 群接口
func (c *ClientConn) ProcToGroupMod(subType uint16, uniqueID int64, data []byte) (respSubType uint16, respData []byte, err error) {

	switch subType {
	case codes.GroupModCreateGroupReq:
		respSubType = codes.GroupModCreateGroupResp
		// 不需要参数直接读取

		var req models.CreateGroupReq
		err = json.Unmarshal(data, &req)
		if err != nil {
			return
		}

		respObj, errApi := c.GroupModCreateGroup(&req)
		if errApi != nil {
			err = errApi
			return
		}
		respData, err = json.Marshal(respObj)
		return
	}

	return
}

func (c *ClientConn) GroupModCreateGroup(req *models.CreateGroupReq) (resp *models.CreateGroupResp, err error) {
	//
	return
}
